package dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.TypedQuery;

import entity.DoctorSpecialty;

@JPA
@Stateless
public class JPADoctorSpecialtyDAO extends GenericJPADAO<DoctorSpecialty> implements DoctorSpecialtyDAO {
	
	@Override
	public DoctorSpecialty selectDoctorSpecialtyByName(String name) {
		TypedQuery<DoctorSpecialty> query = em.createNamedQuery("DoctorSpecialty.selectByName", DoctorSpecialty.class).setParameter("name", name);
		DoctorSpecialty res = query.getSingleResult();
		return res;
	}
	
	@Override
	public List<String> selectDoctorSpecialtyNames() {
		TypedQuery<String> query = em.createNamedQuery("DoctorSpecialty.selectNames", String.class);
		List<String> res = query.getResultList();
		return res;
	}
	
}
